package com.etoak.controller;


import com.etoak.commons.vo.ResultVO;
import com.etoak.entity.Car;
import com.etoak.service.CarService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author et2108
 * @since 2021-12-13
 */
@RestController
@RequestMapping("/car")
public class CarController {

    @Autowired
    CarService carService;
    /**
     * 添加车辆信息接口 post/car
     * 参数类型 application/json
     */
    @PostMapping
    public ResultVO addCar(@RequestBody Car car){

        int result = carService.addCar(car);
        if(result <= 0){
            return ResultVO.error("添加失败");
        }
        return ResultVO.success(StringUtils.EMPTY);
    }
}

